import axios from "axios"


// 实例化axios
const instance = axios.create({
  baseURL: 'http://localhost:8080/api/',
  timeout: 5000,
});
// 将touken方法添加到请求头
export const $setToken =(token) => {
  instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
}
// get 方法
export const $get = async (url,params)=> {
  let {data} = await instance.get(url,{
    params
  })
  return data
}
// post 方法
export const $post = async (url,params)=> {
  let {data} = await instance.post(url,params)
  return data
}
// put 方法
export const $put = async (url,params)=> {
  let {data} = await instance.put(url,params)
  return data
}
// put 方法
export const $delete = async (url,params)=> {
  let {data} = await instance.delete(url,{
    params

  })
  return data
}